Stop rfkill from blocking all radio devices #180
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a bug introduced in af0115e and closes #174
After creating a uinput device with switches support, all radio devices were blocked. This was due to rfkill reacting to the uinput creation.
We disable rfkill-input (the module reacting to new device creation) to avoid blocking all radio devices. When a new device (virtual or physical) with the SW_RFKILL_ALL switch capability bit set appears, rfkill reacts immediately depending on the value bit. This value bit defaults to unset, which causes rfkill to use its default eop mode (emergency power off). The uinput API does not give any way to set the corresponding value bit before creating the device, and we have no way to avoid rfkill acting upon the device creation or to change its default mode. Thus, we disable rfkill-input temporarily, hopefully fast enough that it won't impact anyone. rfkill-input gets enabled automatically after uinput device creation (actually, when the file gets closed).